<?php

    class uploadFile(){

        public function _constructs(){
            header("Content-type:text/html; charset=utf-8");
        }

        public function index(){
            if(is_uploaded_file($_FILES['upFile']['tmp_name'])){
                $upFile = $_FILES['upFile'];
                $name = $upFile['name'];
                $type = $upFile['type'];
                $size = $upFile['size'];
                $tmp_name = $upFile['tmp_name'];

                switch($type){
                    case 'image/jpeg':
                        $okType = true;
                        break;
                    case 'image/gif':
                        $okType = true;
                        break;
                    case 'image/png':
                        $okType = true;
                        break;
                    default :
                        $okType = false;
                        break;
                }

                if($okType){
                    $error = $upFile["error"];//上传后系统返回的值
                    return "================<br/> 上传文件名称是:".$name."<br/>上传文件类型是:".$type.
                           "<br/>上传文件大小是:".$size."<br/>上传后系统返回的值是:".$error."<br/>上传文件的临时存放路径是:".$tmp_name."<br/>";
                }
            }
        }

    }

    $up = new uploadFile();
    $up.index();

?>